from neo4j import GraphDatabase

def check_duplicate_nodes():
    driver = GraphDatabase.driver('neo4j://49.235.155.102:7687', auth=('neo4j', '123qweasd!'))
    session = driver.session()
    
    # 检查"大前端概念"节点
    result = session.run('MATCH (n) WHERE n.name CONTAINS "大前端概念" RETURN labels(n) as labels, n.name as name, n.id as id')
    records = list(result)
    
    print('找到的"大前端概念"节点:')
    for record in records:
        print(f'  标签: {record["labels"]}, 名称: {record["name"]}, ID: {record["id"]}')
    
    # 检查所有Concept节点数量
    concept_result = session.run('MATCH (c:Concept) RETURN count(c) as count')
    concept_count = concept_result.single()["count"]
    print(f'\n总Concept节点数: {concept_count}')
    
    # 检查所有Subtopic节点数量
    subtopic_result = session.run('MATCH (s:Subtopic) RETURN count(s) as count')
    subtopic_count = subtopic_result.single()["count"]
    print(f'总Subtopic节点数: {subtopic_count}')
    
    session.close()
    driver.close()

if __name__ == '__main__':
    check_duplicate_nodes()